﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using LibHuman;
namespace Human
{
	/// <summary>
	/// Summary description for frmGiaCanh.
	/// </summary>
	public class frmDinuocngoai : System.Windows.Forms.Form
	{
		private AccessData  mDB=new AccessData ();
        Language lan = new Language();
		private DataSet ds =new DataSet();
		private System.Windows.Forms.Button butThoat;
		private System.Windows.Forms.TextBox txbTenNV;
		private System.Windows.Forms.TextBox txbHoNV;
		private System.Windows.Forms.ComboBox cbobBoPhan;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button butTim;
		private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txbMaNV;
        private DataGridView dataGridView1;
        private DataGridView dataGridView2;
        private DataGridViewTextBoxColumn Column1;
        private DataGridViewTextBoxColumn Column2;
        private DataGridViewTextBoxColumn Column3;
        private DataGridViewTextBoxColumn Column4;
        private DataGridViewTextBoxColumn Column5;
        private DataGridViewTextBoxColumn Column6;
        private DataGridViewTextBoxColumn Column7;
        private DataGridViewTextBoxColumn Column8;
        private DataGridViewTextBoxColumn Column9;
        private DataGridViewTextBoxColumn Column10;
        private DataGridViewTextBoxColumn Column11;
        private DataGridViewTextBoxColumn Column12;
        private DataGridViewTextBoxColumn Column19;
        private DataGridViewTextBoxColumn Column20;
        private DataGridViewTextBoxColumn Column13;
        private DataGridViewTextBoxColumn Column14;
        private DataGridViewTextBoxColumn Column15;
        private DataGridViewTextBoxColumn Column16;
        private DataGridViewTextBoxColumn Column17;
        private DataGridViewTextBoxColumn Column18;
        private DataGridViewTextBoxColumn Column21;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmDinuocngoai()
		{
			InitializeComponent();
            lan.Read_Language_to_Xml(this.Name.ToString(), this);
            lan.Changelanguage_to_English(this.Name.ToString(), this);
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDinuocngoai));
            this.butThoat = new System.Windows.Forms.Button();
            this.txbTenNV = new System.Windows.Forms.TextBox();
            this.txbHoNV = new System.Windows.Forms.TextBox();
            this.cbobBoPhan = new System.Windows.Forms.ComboBox();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.butTim = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.txbMaNV = new System.Windows.Forms.TextBox();
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridView2 = new System.Windows.Forms.DataGridView();
            this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column19 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column20 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column16 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column17 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column18 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
            this.SuspendLayout();
            // 
            // butThoat
            // 
            this.butThoat.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butThoat.Image = global::Human.Properties.Resources.close_r;
            this.butThoat.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butThoat.Location = new System.Drawing.Point(132, 122);
            this.butThoat.Name = "butThoat";
            this.butThoat.Size = new System.Drawing.Size(60, 28);
            this.butThoat.TabIndex = 34;
            this.butThoat.Text = "Thoát";
            this.butThoat.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.butThoat.Click += new System.EventHandler(this.butThoat_Click);
            // 
            // txbTenNV
            // 
            this.txbTenNV.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txbTenNV.Location = new System.Drawing.Point(68, 62);
            this.txbTenNV.Name = "txbTenNV";
            this.txbTenNV.Size = new System.Drawing.Size(120, 22);
            this.txbTenNV.TabIndex = 2;
            this.txbTenNV.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txbTenNV_KeyDown);
            // 
            // txbHoNV
            // 
            this.txbHoNV.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txbHoNV.Location = new System.Drawing.Point(68, 38);
            this.txbHoNV.Name = "txbHoNV";
            this.txbHoNV.Size = new System.Drawing.Size(152, 22);
            this.txbHoNV.TabIndex = 1;
            this.txbHoNV.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txbHoNV_KeyDown);
            // 
            // cbobBoPhan
            // 
            this.cbobBoPhan.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cbobBoPhan.Location = new System.Drawing.Point(68, 86);
            this.cbobBoPhan.Name = "cbobBoPhan";
            this.cbobBoPhan.Size = new System.Drawing.Size(184, 24);
            this.cbobBoPhan.TabIndex = 3;
            this.cbobBoPhan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbobBoPhan_KeyDown);
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(12, 92);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(53, 13);
            this.label4.TabIndex = 30;
            this.label4.Text = "Bộ phận :";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(38, 41);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(27, 13);
            this.label3.TabIndex = 29;
            this.label3.Text = "Họ :";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(33, 66);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(32, 13);
            this.label2.TabIndex = 28;
            this.label2.Text = "Tên :";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // butTim
            // 
            this.butTim.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butTim.Image = global::Human.Properties.Resources.t_search;
            this.butTim.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butTim.Location = new System.Drawing.Point(66, 122);
            this.butTim.Name = "butTim";
            this.butTim.Size = new System.Drawing.Size(60, 28);
            this.butTim.TabIndex = 4;
            this.butTim.Text = "Tìm";
            this.butTim.Click += new System.EventHandler(this.butTim_Click);
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(21, 17);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(44, 13);
            this.label1.TabIndex = 26;
            this.label1.Text = "Mã NV :";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txbMaNV
            // 
            this.txbMaNV.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txbMaNV.Location = new System.Drawing.Point(68, 14);
            this.txbMaNV.Name = "txbMaNV";
            this.txbMaNV.Size = new System.Drawing.Size(64, 22);
            this.txbMaNV.TabIndex = 0;
            this.txbMaNV.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txbMaNV_KeyDown);
            // 
            // dataGridView1
            // 
            this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
            this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
            this.dataGridView1.ColumnHeadersHeight = 25;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3,
            this.Column4,
            this.Column5,
            this.Column6,
            this.Column7,
            this.Column8});
            this.dataGridView1.Location = new System.Drawing.Point(265, 7);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.RowHeadersWidth = 25;
            this.dataGridView1.Size = new System.Drawing.Size(435, 178);
            this.dataGridView1.TabIndex = 36;
            this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
            this.dataGridView1.CurrentCellChanged += new System.EventHandler(this.dataGridView1_CurrentCellChanged);
            // 
            // Column1
            // 
            this.Column1.DataPropertyName = "mnvmay";
            this.Column1.HeaderText = "Mã NV";
            this.Column1.Name = "Column1";
            this.Column1.Width = 70;
            // 
            // Column2
            // 
            this.Column2.DataPropertyName = "ho";
            this.Column2.HeaderText = "Họ tên";
            this.Column2.Name = "Column2";
            this.Column2.Width = 200;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "tenbp";
            this.Column3.HeaderText = "Bộ phận";
            this.Column3.Name = "Column3";
            this.Column3.Width = 120;
            // 
            // Column4
            // 
            this.Column4.DataPropertyName = "manv";
            this.Column4.HeaderText = "manv";
            this.Column4.Name = "Column4";
            this.Column4.Visible = false;
            // 
            // Column5
            // 
            this.Column5.DataPropertyName = "madv";
            this.Column5.HeaderText = "madv";
            this.Column5.Name = "Column5";
            this.Column5.Visible = false;
            // 
            // Column6
            // 
            this.Column6.DataPropertyName = "honv";
            this.Column6.HeaderText = "honv";
            this.Column6.Name = "Column6";
            this.Column6.Visible = false;
            // 
            // Column7
            // 
            this.Column7.DataPropertyName = "tennv";
            this.Column7.HeaderText = "tennv";
            this.Column7.Name = "Column7";
            this.Column7.Visible = false;
            // 
            // Column8
            // 
            this.Column8.DataPropertyName = "diengiai";
            this.Column8.HeaderText = "diengiai";
            this.Column8.Name = "Column8";
            this.Column8.Visible = false;
            // 
            // dataGridView2
            // 
            this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
            this.dataGridView2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            this.dataGridView2.ColumnHeadersHeight = 25;
            this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column9,
            this.Column10,
            this.Column11,
            this.Column12,
            this.Column19,
            this.Column20,
            this.Column13,
            this.Column14,
            this.Column15,
            this.Column16,
            this.Column17,
            this.Column18,
            this.Column21});
            this.dataGridView2.Location = new System.Drawing.Point(7, 192);
            this.dataGridView2.Name = "dataGridView2";
            this.dataGridView2.RowHeadersWidth = 25;
            this.dataGridView2.Size = new System.Drawing.Size(694, 237);
            this.dataGridView2.TabIndex = 37;
            // 
            // Column9
            // 
            this.Column9.DataPropertyName = "t_ngay";
            this.Column9.HeaderText = "Từ ngày";
            this.Column9.Name = "Column9";
            this.Column9.Width = 80;
            // 
            // Column10
            // 
            this.Column10.DataPropertyName = "d_ngay";
            this.Column10.HeaderText = "Đến ngày";
            this.Column10.Name = "Column10";
            this.Column10.Width = 80;
            // 
            // Column11
            // 
            this.Column11.DataPropertyName = "l_gi";
            this.Column11.HeaderText = "Nội dung";
            this.Column11.Name = "Column11";
            this.Column11.Width = 150;
            // 
            // Column12
            // 
            this.Column12.DataPropertyName = "ten_qg";
            this.Column12.HeaderText = "Tên nước";
            this.Column12.Name = "Column12";
            this.Column12.Width = 150;
            // 
            // Column19
            // 
            this.Column19.DataPropertyName = "thoigian";
            this.Column19.HeaderText = "Thời gian";
            this.Column19.Name = "Column19";
            // 
            // Column20
            // 
            this.Column20.DataPropertyName = "dv";
            this.Column20.HeaderText = "Đơn vị thời gian";
            this.Column20.Name = "Column20";
            // 
            // Column13
            // 
            this.Column13.DataPropertyName = "manv";
            this.Column13.HeaderText = "manv";
            this.Column13.Name = "Column13";
            this.Column13.Visible = false;
            this.Column13.Width = 120;
            // 
            // Column14
            // 
            this.Column14.DataPropertyName = "mnvmay";
            this.Column14.HeaderText = "mnvmay";
            this.Column14.Name = "Column14";
            this.Column14.Visible = false;
            // 
            // Column15
            // 
            this.Column15.DataPropertyName = "madv";
            this.Column15.HeaderText = "madv";
            this.Column15.Name = "Column15";
            this.Column15.Visible = false;
            // 
            // Column16
            // 
            this.Column16.DataPropertyName = "tenbp";
            this.Column16.HeaderText = "tenbp";
            this.Column16.Name = "Column16";
            this.Column16.Visible = false;
            // 
            // Column17
            // 
            this.Column17.DataPropertyName = "ho";
            this.Column17.HeaderText = "ho";
            this.Column17.Name = "Column17";
            this.Column17.Visible = false;
            // 
            // Column18
            // 
            this.Column18.DataPropertyName = "ten";
            this.Column18.HeaderText = "ten";
            this.Column18.Name = "Column18";
            this.Column18.Visible = false;
            // 
            // Column21
            // 
            this.Column21.DataPropertyName = "maqgia";
            this.Column21.HeaderText = "maqgia";
            this.Column21.Name = "Column21";
            this.Column21.Visible = false;
            // 
            // frmDinuocngoai
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.ClientSize = new System.Drawing.Size(711, 436);
            this.Controls.Add(this.dataGridView2);
            this.Controls.Add(this.dataGridView1);
            this.Controls.Add(this.butThoat);
            this.Controls.Add(this.txbTenNV);
            this.Controls.Add(this.txbHoNV);
            this.Controls.Add(this.cbobBoPhan);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.butTim);
            this.Controls.Add(this.txbMaNV);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ForeColor = System.Drawing.Color.DarkBlue;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "frmDinuocngoai";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Quá trình đi nước ngoài";
            this.Load += new System.EventHandler(this.frmGiaCanh_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		private void butThoat_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
		
		private void Load_Bophan()
		{
			cbobBoPhan.DisplayMember="tenbp";
			cbobBoPhan.ValueMember="madv";
			cbobBoPhan.DataSource=mDB.get_bophan().Tables[0];
		}

		private void frmGiaCanh_Load(object sender, System.EventArgs e)
		{
			txbMaNV.Focus();
		    Load_Bophan();
			cbobBoPhan.SelectedIndex=-1;
		}

		private void LoadTim_NV()
		{
			string ma_nv,ho_nv,ten_nv,bo_phan;
			ma_nv=txbMaNV.Text.Trim();
			ho_nv=txbHoNV.Text.Trim().ToUpper();
			ten_nv=txbTenNV.Text.Trim().ToUpper();
			bo_phan=(cbobBoPhan.SelectedIndex==-1)?"":cbobBoPhan.SelectedValue.ToString();
			
			ds=mDB.TimNV(ma_nv,ho_nv,ten_nv,bo_phan);
            dataGridView1.DataSource = ds.Tables[0];

            CurrencyManager cm = (CurrencyManager)BindingContext[dataGridView1.DataSource, dataGridView1.DataMember];
            DataView dv = (DataView)cm.List;
            dv.AllowNew = false;
            dv.AllowEdit = false;

			
		}
        private DataSet f_TimDiNN(string ma_nv)
        {
            string sql = "";
            sql = "SELECT l.mnvmay, l.manv,";
            sql += " l.ho, l.ten, b.madv, b.tenbp,";
            sql += " to_char(c.tungay,'dd/mm/yyyy') as t_ngay,";
            sql += " to_char(c.denngay,'dd/mm/yyyy') as d_ngay,";
            sql += " c.lamgi as l_gi, c.maqgia,";
            sql += " d.tenqg as ten_qg, c.tgian as thoigian, c.dvtgian as dv";
            sql += " from " + mDB.user + ".llnv l inner join " + mDB.user + ".xuatcanh c on l.manv=c.manv ";
            sql += " inner join " + mDB.user + ".quocgia d on c.maqgia = d.maqg ";
            sql += " left join " + mDB.user + ".bophan b on l.madv = b.madv ";
            sql += " WHERE l.manv='" + ma_nv.Trim() + "'";
            return mDB.get_data(sql);
        }

		private void butTim_Click(object sender, System.EventArgs e)
		{
			try
			{
				LoadTim_NV();
			}
			catch{}
		}

		private void txbMaNV_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode.ToString() == "Enter")
			{ 
				if (txbMaNV.Text.Length < 5)	
					txbMaNV.Text = txbMaNV.Text.PadLeft(5,'0');
				SendKeys.Send("{Tab}");
			}
		}

		private void txbHoNV_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode.ToString() == "Enter")
				SendKeys.Send("{Tab}");
		}

		private void txbTenNV_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode.ToString() == "Enter")
				SendKeys.Send("{Tab}");
		}

		private void cbobBoPhan_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode.ToString() == "Enter")
				SendKeys.Send("{Tab}");
		}

		private void dgrGiaCanh1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode.ToString() == "Enter")
				SendKeys.Send("{Tab}");
		}
        
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string ma_nvl = "";
                DataRowView arv = (DataRowView)(dataGridView1.CurrentRow.DataBoundItem);
                ma_nvl = arv["manv"].ToString();
                ds = f_TimDiNN(ma_nvl);
                dataGridView2.DataSource = ds.Tables[0];
                CurrencyManager cm = (CurrencyManager)BindingContext[dataGridView2.DataSource, dataGridView2.DataMember];
                DataView dv = (DataView)cm.List;
                dv.AllowNew = false;
                dv.AllowEdit = false;
            }
            catch
            {
            }
        }

        private void dataGridView1_CurrentCellChanged(object sender, EventArgs e)
        {
            dataGridView1_CellClick(null, null);
        }

	}
}
